package com.donger.auth.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.security.authentication.event.AuthenticationSuccessEvent;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;

/**
 * 登陆成功处理器
 * @author 7326
 */
@Component
@Slf4j
public class AuthenticationSuccessHandler implements ApplicationListener<AuthenticationSuccessEvent> {
    @Override
    public void onApplicationEvent(AuthenticationSuccessEvent authenticationSuccessEvent) {
        Authentication authentication = (Authentication) authenticationSuccessEvent.getSource();
        log.debug("用户: {} 登陆成功",authentication.getCredentials());

    }
}
